package customer.zspt.cn.customer.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.BitmapUtils;

import customer.zspt.cn.customer.R;
import customer.zspt.cn.customer.bean.SkillInfoDao;

public class GroupViewAdapter extends BaseAdapter
{
    private SkillInfoDao skillInfoDao;
    private Context context;
    private BitmapUtils utils;
    public GroupViewAdapter(Context context,SkillInfoDao skillInfoDao){
        utils = new BitmapUtils(context);
        this.context = context;
        this.skillInfoDao = skillInfoDao;
    }
    @Override
    public int getCount() {
        return skillInfoDao.data.kefus.size();
    }

    @Override
    public Object getItem(int i) {
        return skillInfoDao.data.kefus.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if(view==null)
        {
            view = View.inflate(context, R.layout.group_view_groupitem,null);
            holder = new ViewHolder();
            holder.Userhead = view.findViewById(R.id.Userhead);
            holder.userName = view.findViewById(R.id.userName);
            view.setTag(holder);
        }
        else{
            holder = (ViewHolder) view.getTag();
        }
        utils.display(holder.Userhead,skillInfoDao.data.kefus.get(i).kefuAvatar);
        holder.userName.setText(skillInfoDao.data.kefus.get(i).kefuRealname);
        return view;
    }
    class ViewHolder{
        ImageView Userhead;
        TextView userName;
    }
}
